package com.sky.controller.user;

import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.web.bind.annotation.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;

import java.util.List;
import com.sky.result.Result;
import org.springframework.web.client.RestTemplate;

@RestController("userShopController")
@RequestMapping("/user/shop")
@Api(tags = "营业状态")
@Slf4j
public class ShopController {
    public static final String KEY = "SHOP_STATUS";

    @Autowired
    private RedisTemplate redisTemplate;


    /*
    查询店铺营业状态
     */
    @GetMapping("/status")
    public Result<Integer> getStatus(){
        Integer status = (Integer) redisTemplate.opsForValue().get(KEY);
        //设置默认值
        if (status == null){
            status = 1;
        }
        return Result.success(status);
    }

}
